package org.deltaset.samples.petclinic.visit.menu;

import java.util.ArrayList;
import java.util.List;
import javax.annotation.ManagedBean;
import javax.inject.Inject;
import org.deltaset.desktop.MenuGroup;
import org.deltaset.samples.petclinic.visit.Animal;
import org.deltaset.samples.petclinic.visit.Person;
import org.deltaset.samples.petclinic.menu.MenuRegistry;


/**
 *
 * @author dmakariev
 */
@ManagedBean
public class LibraryMenu {

    private final static String ENTITY_SRC = "/record/meta-entity.xhtml";
    private final MenuRegistry menuRegistry;
    

    @Inject
    public LibraryMenu(MenuRegistry menuRegistry) {
        this.menuRegistry = menuRegistry;
        this.menuRegistry.getTopMenu().get(0).getMenuGroups().addAll(initMiniHome());
    }
	
		private List<MenuGroup> initMiniHome() {
        final List<MenuGroup> menuGroups = new ArrayList<MenuGroup>();
        menuGroups.add(MenuRegistry.autoObjects("Visit", "org.deltaset.samples.petclinic.visit")
                );
//        menuGroups.add(new MenuGroup("Record").add(Person.class, ENTITY_SRC).
//                add(Animal.class, ENTITY_SRC));

        return menuGroups;
    }

    //private List<MenuGroup> initMiniHome() {
    //    final List<MenuGroup> menuGroups = new ArrayList<MenuGroup>();
    //    menuGroups.add(new MenuGroup("visit").add(Person.class, ENTITY_SRC).
    //            add(Animal.class, ENTITY_SRC));

    //    return menuGroups;
    //}
}
